import React from 'react';

export default class Main extends React.Component{
    constructor(props){
        super(props);
    }
    render(){
        const { userid,username,time,template } = this.props;
        String.prototype.replaceAll = function(s1, s2) {
            return this.replace(new RegExp(s1, "gm"), s2);
        }
        let msg = template.replaceAll("\\${user}", `<span class="wf-reject-msg-user"><a href="javaScript:openhrm(${userid})" onClick="javaScript:window.pointerXY(event)">${username}</a></span>`)
        msg = msg.replace("${time}", `<span class="wf-reject-msg-time">${time}</span>`);
        return (
            <div className="wf-reject-msg">
                <span><i className="icon-coms02-Warning-01" /></span>
                <span dangerouslySetInnerHTML={{__html:msg}}></span>
            </div>
        )
    }
}